<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal"
	scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

	<%@ include file="/WEB-INF/include/header.jsp"%>
	<%@ include file="/WEB-INF/include/submenu.jsp"%>

	<div class="container-fluid ms-container has-ms-sidemenu">

		<ol class="ms-breadcrumb breadcrumb">
			<li class="active">生成派车单</li>
		</ol>

		<div class="ms-content-layout has-operation">

			<form method="GET" id="validate-form" data-validate="true">

				<input type="hidden" name="queryString" value="${queryString}" /> <input
					type="hidden" name="target" value="${target}">

				<div class="ms-operation-bar no-margin no-bottom-border clearfix">
					<div class="ms-operation-group pull-right">
						<button type="submit" class="btn ms-btn ms-btn-blue">
							<i class="glyphicon"></i>&nbsp;&nbsp;新建派车单
						</button>
					</div>
				</div>

				<div class="radio-check"></div>
				<table class="table table-hover ms-table">
					<thead class="blue-header">
						<tr>
							<th>选中</th>
							<th>运输公司</th>
							<th>安吉调度指令号</th>
							<th>调度指令组号</th>
							<th>日期</th>
							<th>起始地（装卸地）</th>
							<th>目的地（装卸地）</th>
							<th>驳运车号</th>
							<th>调度数量</th>
							<th>预计装运时间</th>
							<th>预计起运时间</th>
							<th>运输方式</th>
							<th>事故标志</th>
						</tr>
					</thead>

					<tbody>
						<c:forEach items="${shipments}" var="shipment">
							<tr>
								<td><input type="radio" name="shipmentNumber"
									value="${shipment.shipmentNumber}" autocomplete="off" /></td>
								<td>${empty shipment.transCorpId ? '': persist.organization(shipment.transCorpId).name}</td>
								<td>${shipment.shipmentNumber}</td>
								<td>${shipment.shipmentGroup}</td>
								<td><fmt:formatDate value="${shipment.createTime}"
										pattern="yyyy-MM-dd" /></td>
								<td>${empty shipment.srcWhId ? '' : ( persist.warehouse(shipment.srcWhId).loadPlaceCode ).concat( '-' ).concat( persist.warehouse(shipment.srcWhId).loadPlaceName )}</td>
								<td>${empty shipment.destWhId ? '' : ( persist.warehouse(shipment.destWhId).loadPlaceCode ).concat( '-' ).concat( persist.warehouse(shipment.destWhId).loadPlaceName )}</td>
								<td>${empty shipment.transMeansId ? '' : ( persist.vehicle(shipment.transMeansId).code ).concat( '-' ).concat( persist.vehicle(shipment.transMeansId).name )}</td>
								<td>${shipment.loadQuantity}</td>
								<td><fmt:formatDate value="${shipment.loadingTime}"
										pattern="yyyy-MM-dd HH:mm:ss" /></td>
								<td><fmt:formatDate value="${shipment.leavingTime}"
										pattern="yyyy-MM-dd HH:mm:ss" /></td>
								<td>${empty shipment.transType ? '' : shipment.transType.description}</td>
								<td>${shipment.accident ? '是': '否'}</td>
							</tr>
						</c:forEach>
					</tbody>

					<tfoot>
						<tr>
							<td colspan="13" class="no-vertical-padding">
								<div class="pull-left">
									<jsp:include page="/WEB-INF/include/page.jsp">
										<jsp:param name="url" value="${ctx.host}/shipment-lines" />
										<jsp:param name="queryString" value="${queryString}" />
									</jsp:include>
								</div>

								<div class="pull-right">
									<c:if test="${page.totals > 0}">
										<a
											href="${ctx.host}/shipment-lines/export?${queryString}&per_page=${config.everyPage}&page=${page.currentPage}"
											class="btn btn-default ms-export">输出当前记录</a>
										<a
											href="${ctx.host}/shipment-lines/export-all?${queryString}&limit=${config.limit}"
											class="btn btn-default ms-export">输出所有记录</a>
									</c:if>
								</div>
							</td>
						</tr>
					</tfoot>
				</table>

			</form>

		</div>
	</div>

	<%@ include file="/WEB-INF/include/script.jsp"%>
	<d:resource type="script" root="${ctx.resource}/build"
		src="js/page/business/shipment/shipment-generate-list.js" />
	<script type="text/javascript">
		require([ 'page/business/shipment/shipment-generate-list' ], function(
				page) {
			page.init()
		})
	</script>

</body>
</html>